import SecureLS from 'secure-ls'
import config from '@/config'

const ls = new SecureLS({
    encodingType: config.LS_ENCRYPTION,
    isCompression: !!config.LS_ENCRYPTION,
    encryptionSecret: config.LS_ENCRYPTION_KEY
})

export const SelfStorage = {
    getItem(key: string) {
        return ls.get(key)
    },

    setItem(key: string, value: any) {
        ls.set(key, value)
    }
}
